# -*_ codeing=utf-8 -*-
# @Time: 2025/10/29 12:56
# @Author: foxhuty
# @File: many_to_many_query.py
# @Software: PyCharm
# @Based on python 3.10

from sqlalchemy.orm import sessionmaker
from sqlalchemy_notes.db_main import engine
from sqlalchemy_notes.student_manager.models import Users, RolePlayers

with sessionmaker(bind=engine).begin() as session:
    user=session.get(Users,13)
    for role in user.roles:
        print(role.role_name)

    role=session.get(RolePlayers,16)
    for user in role.users:
        print(user.username)

